package com.alangyun.remind.service.excel;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.alangyun.remind.repository.IDataset;

public class ParseResult implements Serializable {

	private IDataset object;
	private List<String> errors;
	
	public ParseResult() {
		errors = new ArrayList<String>();
	}

	public IDataset getObject() {
		return object;
	}


	public void setObject(IDataset object) {
		this.object = object;
	}


	public List<String> getErrors() {
		return errors;
	}
	
	public void addError(String error) {
		errors.add(error);
	}
	
	public boolean hasError() {
		return errors.size()>0;
	}
	
	public String toString() {
		if(errors.size()<=0)
			return "";
		
		StringBuilder sb = new StringBuilder();
		for(String s: errors)
			sb.append(s).append("\n");
		
		return sb.toString();
	}
}
